package com.micro.modual.service.impl;

import com.micro.common.MicroResponseCode;
import com.micro.core.exception.BizException;
import com.micro.core.frame.service.impl.AbstractBasicsServiceImpl;
import com.micro.core.resp.RespJson;
import com.micro.modual.entity.UserStatisticsInfo;
import com.micro.modual.extension.UserStatisticsInfoExtension;
import com.micro.modual.mapper.UserStatisticsInfoMapper;
import com.micro.modual.model.bo.userstatisticsinfo.UserStatisticsInfoBO;
import com.micro.modual.service.UserStatisticsInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
*  <h1>用户统计记录表(管理员进行查看)  实现</h1>
 * @author LevelCoder
 * @version V1.0.0
 * @email LevelCoder@126.com
 * @date 2020-08-04 00:11:09
 */
@Service("userStatisticsInfoService")
public class UserStatisticsInfoServiceImpl extends AbstractBasicsServiceImpl<UserStatisticsInfo,Long> implements UserStatisticsInfoService {

    @Autowired
    private UserStatisticsInfoMapper userStatisticsInfoMapper;

    /**
     * <h2>新增用户统计记录表(管理员进行查看)详情</h2>
     * @param userStatisticsInfoBO {@link UserStatisticsInfoBO} 用户统计记录表(管理员进行查看) 新增/修改 请求对象
     * @return {@link RespJson} 返回结果基础类
     */
    @Override
    public RespJson addUserStatisticsInfo(UserStatisticsInfoBO userStatisticsInfoBO) {
        UserStatisticsInfo userStatisticsInfo = UserStatisticsInfoExtension.converAddUserStatisticsInfo(userStatisticsInfoBO);
        userStatisticsInfoMapper.insertSelective(userStatisticsInfo);
        return new RespJson(MicroResponseCode.SUCCESS.getResponseCode(), MicroResponseCode.SUCCESS.getResponseMessage());
    }

    /**
     * <h2>修改用户统计记录表(管理员进行查看)详情</h2>
     * @param userStatisticsInfoBO  {@link UserStatisticsInfoBO} 用户统计记录表(管理员进行查看) 新增/修改 请求对象
     * @return {@link RespJson} 返回结果基础类
     */
    @Override
    public RespJson editUserStatisticsInfo(UserStatisticsInfoBO userStatisticsInfoBO) {
        UserStatisticsInfo userStatisticsInfo = UserStatisticsInfoExtension.converEditUserStatisticsInfo(userStatisticsInfoBO);
        userStatisticsInfoMapper.updateByPrimaryKeySelective(userStatisticsInfo);
        return new RespJson(MicroResponseCode.SUCCESS.getResponseCode(),MicroResponseCode.SUCCESS.getResponseMessage());

    }

    /**
     * <h2>根据主键编号删除用户统计记录表(管理员进行查看)信息</h2>
     * @param id  用户统计记录表(管理员进行查看) 主键编号
     * @return  {@link RespJson} 返回结果基础类
     */

    @Override
    public RespJson deleteUserStatisticsInfo(Long id) {
        userStatisticsInfoMapper.deleteByPrimaryKey(id);
        return new RespJson(MicroResponseCode.SUCCESS.getResponseCode(),MicroResponseCode.SUCCESS.getResponseMessage());
    }

}
